package com.itfallrain.service;

import com.itfallrain.common.MD5Encode;
import com.itfallrain.dao.UserMapper;
import com.itfallrain.entity.User;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {
    @Autowired
    private UserMapper userMapper;
    public User login(String login_id, String password){
        User u=userMapper.selectByLoginId(login_id);
//        System.out.println(u);
        String paw= MD5Encode.encode(password);
//        System.out.println("pp"+paw);
        if(u!=null&&u.getPassword().equals(paw)){
             u.setPassword(null);
            return u;
        }else{
        }
        return null;
    }
}
